﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TTMarketing
{
    public partial class danh_sach_san_pham : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["typeid"] != null)
            {
                this.MultiView1.ActiveViewIndex = 0;
            }
            else
            {
                if (Request.QueryString["cateid"] != null)
                {
                    this.MultiView1.ActiveViewIndex = 1;
                }
                else
                    if (Request.QueryString["type"] != null)
                    {
                        this.MultiView1.ActiveViewIndex = 2;
                    }else
                        if (Request.QueryString["id"] != null)
                        {
                            this.MultiView1.ActiveViewIndex = 3;
                        }
            }
        }

        protected void btnNew_Click(object sender, EventArgs e)
        {
            try
            {
                if(!String.IsNullOrEmpty(this.txtName.Text)||!String.IsNullOrEmpty(this.txtGia.Text))
                    Response.Redirect("~/danh-sach-san-pham.aspx?type=new&name=" + this.txtName.Text + "&price=" + this.txtGia.Text);

            }
            catch (Exception)
            {
                
                throw;
            }
        }

        protected void btnHot_Click(object sender, EventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(this.txtName.Text) || !String.IsNullOrEmpty(this.txtGia.Text))
                Response.Redirect("~/danh-sach-san-pham.aspx?type=hot&name=" + this.txtName.Text + "&price=" + this.txtGia.Text);
            }
            catch (Exception)
            {

                throw;
            }
        }

        protected void btnSale_Click(object sender, EventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(this.txtName.Text) || !String.IsNullOrEmpty(this.txtGia.Text))
                    Response.Redirect("~/danh-sach-san-pham.aspx?type=sale&name=" + this.txtName.Text + "&price=" + this.txtGia.Text);
                else
                    Response.Redirect("~/khuyen-mai.aspx");
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}